extends layout

block content
  - var imagelikes = likes ? likes : 0
  - var imagevisits = visit ? visit : 0
  .row
    ul.nav
      li.nav-item
        a.nav-link.active(href="http://localhost:3000") 首页
      li.nav-item
        a.nav-link.active(href="#comments") 评论
      li.nav-item
        a.nav-link.active(href="#publishcomment") 发表评论
      li.nav-item
        a.nav-link.active(href="#newcomments") 最新评论
  hr
  .row
    .col-12.col-md-8
      .card
        img.card-img-top(src=`/uploads/${diskfilename}`, alt=title)
        .card-body.d-flex.justify-content-between.align-items-center
          div.inline-block
            span= description
          div.inline-block
            i.fa.fa-eye
            span#visitsnum(data-imageid=_id)= imagevisits
            span &nbsp;&nbsp;
            button.fa.fa-heart-o#likes-btn(data-imageid=_id, style='border:0;background-color:#ffffff')= imagelikes
          div.inline-block
            span= "作者：" + imageauthor
            
      .list-group.mt-1#comments
        each comment in comments
          div.card.mt-1
            div.card-body
              ul.list-unstyled
                li
                  h5.card-title= comment.nickname
                    small= comment.email
                  p &nbsp;&nbsp;&nbsp;&nbsp;
                    span= comment.comment
                  .d-flex.flex-row-reverse
                    p= comment.createdAt
                    span 创建时间：
    .col-12.col-md-4
      include includes/stats.pug 
      .list-group.mt-1#newcomments
        include includes/newcomments.pug   
  
  .row.mt-1#publishcomment
    .col-12.col-md-8
      .card
        .card-body
          h4.card-title 发表评论
          form(action=`/comments/${_id}`, method="post")
            .form-group.row
              label.col-12.col-md-2 邮箱
              input.col-12.col-md-10.form-control(type="email", name="email")
            .form-group.row
              label.col-12.col-md-2 昵称
              input.col-12.col-md-10.form-control(type="text", name="nickname")
            .form-group.row
              label.col-12.col-md-2 评论
              textarea.col-12.col-md-10.form-control(rows="5", name="comment")
            .form-group.row
              .col-12.offset-md-8.col-md-4
                button.btn.btn-primary.btn-block(type="submit") 保存评论
    .col-12.col-md-4
      include includes/ranks.pug
    
  //- .row.mt-1#newcomments
  //-   .col-12.col-md-12
  //-     include includes/newcomments.pug
  include includes/foot.pug
  script(src="/javascripts/show.js")

  